package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.EmployeeBean;
import com.project.mapper.IEmployeeMapper;
import com.project.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 员工业务接口实现类
 */
@Service
@Transactional
public class EmployeeServiceImpl implements IEmployeeService {
    @Autowired
    private IEmployeeMapper mapper;

    @Override
    public PageInfo<EmployeeBean> findByItem(int pageNum, String name, String job, String state, String ruler) {
        PageHelper.startPage(pageNum,PAGESIZE);
        PageInfo<EmployeeBean> info = PageInfo.of(mapper.findByItem(pageNum, name, job, state, ruler));
        return info;
    }

    @Override
    public void add(EmployeeBean employeeBean) {
        mapper.add(employeeBean);
    }

    @Override
    public void updateState(int id, String state) {
        mapper.updateState(id, state);
    }


    @Override
    public void update(int id, int phone, int money) {
        mapper.update(id, phone, money);
    }

    @Override
    public EmployeeBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public List<EmployeeBean> findOther(int processId, String name, String job) {
        return mapper.findOther(processId, name, job);
    }
}
